<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../libs/vue.js"></script>
</head>
<body>
    <div id="app">
        <h2>{{msg}}</h2>
        <hr>
        <h2>{{getMsg}}</h2>
        <hr>
        <h2>{{fullName}}</h2>
        <button @click="updateMsg">点击修改msg</button>
    </div>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                msg:'hello vue',
                firstName:'张',
                lastname:'三'
            },
            methods: {
                updateMsg(){
                    this.msg = '哈哈哈'
                }
            },
            // 计算属性
            computed:{
                getMsg(){
                    return this.msg + '~~~~'
                },
                fullName(){
                    return this.firstName + this.lastname
                }
            }
        })
    </script>
</body>
</html>